import Vue from 'vue'
import Vuex from 'vuex'
import mutations from './mutations'
import actions from './actions'
import getters from './getters'

//安装插件
Vue.use(Vuex)

//创建store对象
const store = new Vuex.Store({
  state: {
    cartList: []
  },
  //唯一的目的就是修改state中的值
  //mutations中的每个方法尽可能完成的事件单一一点
  mutations,
  //vueComponent->action->mutations->state
  actions,
  getters
})

//挂载到vue实例上
export default store
